<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!-- header -->
<jsp:include page="../include/header.jsp"></jsp:include>
	<header id="header">

	<!--/header-middle-->
	<jsp:include page="../include/header_middle.jsp"></jsp:include>		
	
	<!--header-bottom-->
	<jsp:include page="../include/header_bottom.jsp"></jsp:include>	
	<!--/header-bottom-->
	
	</header>
	<!--/header-->
	
	<section>
		<div class="container">
			<div class="row">
				<div class="col-sm-2">
				</div>
				
				<div class="col-sm-9 padding-right">	
					<!--각자 삽입할 부분-->
					<form name="f" action="boardwrite" method="post" enctype="multipart/form-data">
					<table class="table table-bordered">
						<tr>
							<td width="10%" align="center">카테고리</td>
							<td width="15%" align="center">
								<select name="board_type">
									<c:forEach items="${ typeList }" var="type">
										<option value="${ type.btype_no }">${ type.btype_name }</option>	
									</c:forEach>
								</select>
							</td>
							<td width="75%"></td> 
						</tr>

						<tr>
							<td align="center">제목</td>
							<td colspan="2"><input type="text" name="board_title" class="col-lg-12"/></td>
						</tr>
						
						<tr>
							<td colspan="3" bgcolor="#fe980f"></td>
						</tr>

						<tr>
							<td colspan="3">
								<textarea id="content" name="board_content" class="form-control" rows="10"></textarea>
							</td>
						</tr>
						
					</table>
					
					<div class="row" align="center">
						<button type="submit" class="btn btn-primary btn-lg" onclick="replace()">쓰기</button>
					</div>
					
					<input type="hidden" value="" name="board_image"/>
					
					</form>
					
					<br/>
					<br/>
					<br/>
					
					<!--삽입 끝 -->					
				</div>
			</div>
		</div>
	</section>
	
	<script type="text/javascript">
		function replace(){
			document.f.content.value = document.f.content.value.replace( /\n/gi, "<br//>");
		}
		
		function replace_br(){
			document.f.content.value = document.f.content.value.split("<br//>").join("\n");
		}
		
		window.onload=replace_br;
	</script>
	
	<!--Footer-->
	<jsp:include page="../include/footer.jsp"></jsp:include>
	<!--/Footer-->